package com.wm.walmart.service.impl;

import com.wm.walmart.entity.User;
import com.wm.walmart.mapper.UserMapper;
import com.wm.walmart.service.IUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import javax.annotation.Resource;

import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author xieyize
 * @since 2019-12-09
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService {
	@Resource
	private UserMapper uMapper;

	/**
	 * 根据用户名查询用户信息
	 */
	public User getUserByUName(String name) {
		return uMapper.getUserByUName(name);
	}

	/**
	 * 根据用户id修改最后一次登录时间updateLastLoginTime
	 */
	public int updateLastLoginTime(Integer uId, String lastLoginTime) {
		return uMapper.updateLastLoginTime(uId, lastLoginTime);
	}

	/**
	 * 根据用户id修改用户密码错误次数
	 */
	public int updatePwdWrong(String uName, Integer count) {
		return uMapper.updatePwdWrong(uName, count);
	}

	/**
	 * 根据用户名和密码获取用户信息
	 */
	public User getUserByNameAndPas(String uName, String uPword) {
		return uMapper.getUserByNameAndPas(uName, uPword);
	}

	/**
	 * 根据用户名称修改用户密码错误次数
	 */
	public int updateUserPasWrongByLoginName(String uName, Integer count) {
		return uMapper.updateUserPasWrongByLoginName(uName, count);
	}

	/**
	 * 根据用户id锁定改用户信息
	 */
	public int updateLockOutById(Integer uId,String lockTime) {
		return uMapper.updateLockOutById(uId,lockTime);
	}

	/**
	 * 根据用户ID解锁该用户
	 */
	public int updateUnLockOutById(Integer uId) {
		return uMapper.updateUnLockOutById(uId);
	}

}
